<?php
class UploadedFile{
   
	
  public function upload($file,$path,$name){	
        $UploadedFile=$file[$name]['tmp_name']; 
        $UploadedFile_name=$file[$name]['name']; 
        $isTrue=false; 

        if($UploadedFile) 
        { 
              $store_dir=$path; 
              $accept_overwrite = 1; 
              $isTrue=true; 
        } 
     $fileName = date("YmtHis").$UploadedFile_name; 
     $mytype =array(".jpg",".gif",".png"); 
     $filetype=substr($file[$name]['name'],strrpos($file[$name]['name'],".")); 
     $typecount=0; 
     if($isTrue) 
     { 
       for($i=0;$i<count($mytype);$i++) 
       { 
         if($filetype==$mytype[$i]) 
          { 
               $typecount++; 
          } 
       } 
       if($typecount>0) 
      { 
           if($file[$name]['size']<1048576) 
         { 
               $b=move_uploaded_file($UploadedFile,$store_dir.$fileName); 
                   if($b) 
                  { 
 
                  } 
         }else{ 
              echo ""; 
         } 
      }else{ 
              echo ""; 
      } 
      } 
}
}
?>

